package cn.iocoder.yudao.module.reservation.dal.mysql.employee;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.reservation.dal.dataobject.employee.EmployeeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.reservation.controller.admin.employee.vo.*;

/**
 * 店员 Mapper
 *
 * @author yy
 */
@Mapper
public interface EmployeeMapper extends BaseMapperX<EmployeeDO> {

    default PageResult<EmployeeDO> selectPage(EmployeePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeDO>()
                .eqIfPresent(EmployeeDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(EmployeeDO::getCode, reqVO.getCode())
                .likeIfPresent(EmployeeDO::getName, reqVO.getName())
                .eqIfPresent(EmployeeDO::getGender, reqVO.getGender())
                .eqIfPresent(EmployeeDO::getBirthday, reqVO.getBirthday())
                .eqIfPresent(EmployeeDO::getIdNumber, reqVO.getIdNumber())
                .eqIfPresent(EmployeeDO::getPhone, reqVO.getPhone())
                .eqIfPresent(EmployeeDO::getEmail, reqVO.getEmail())
                .eqIfPresent(EmployeeDO::getPosition, reqVO.getPosition())
                .betweenIfPresent(EmployeeDO::getHireDate, reqVO.getHireDate())
                .betweenIfPresent(EmployeeDO::getResignDate, reqVO.getResignDate())
                .eqIfPresent(EmployeeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(EmployeeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(EmployeeDO::getId));
    }

}